#ifndef _BLOCKBREAKER_COMM_SEMAPHORE_H__
#define _BLOCKBREAKER_COMM_SEMAPHORE_H__

// Sistema
#include <windows.h>

#define MAX_SEMAPHORE_VALUE 5000

class Semaphore
{
    public:
        typedef enum
        {
            SEMAPHORE_TIMEOUT_EXCEPTION,
            SEMAPHORE_DELETED_EXCEPTION,
        }SemaphoreExceptionType;

        explicit Semaphore(unsigned int valor_inicial = 0);

        virtual ~Semaphore(void);

        void wait(unsigned int timeout = 0);

        void signal();

        void reset();

    private:
        HANDLE semaphore_handle;

        bool semaphore_deleted;

        unsigned int count;
};
#endif // _BLOCKBREAKER_COMM_SEMAPHORE_H__